//https://leetcode.cn/problems/house-robber/
//int rob(int* nums, int numsSize) {
    if (numsSize == 1)
    {
        return nums[0];
    }

    if (numsSize == 2)
    {
        return nums[0] > nums[1] ? nums[0] : nums[1];
    }
    int prev = nums[0];
    int cur = nums[0] > nums[1] ? nums[0] : nums[1];
    int i = 2;
    while (i < numsSize)
    {
        int tmp = cur;
        cur = cur > prev + nums[i] ? cur : prev + nums[i];
        prev = tmp;
        ++i;
    }
    return cur;
}